<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<%@ include file="/WEB-INF/views/include/constrant.jsp"%>
<html>
<head>
<title>订单一览</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(function() {
		$("#btnExport").click(function(){
			top.$.jBox.confirm("确认要导出用户数据吗？","系统提示",function(v,h,f){
				if(v=="ok"){
					$("#searchForm").attr("action","${ctx}/orders/tOrders/exportall");
					$("#searchForm").submit();
					$("#searchForm").attr("action","${ctx}/orders/tOrders/allOrderList");
				}
			},{buttonsFocus:1});
			top.$('.jbox-body .jbox-icon').css('top','55px');
		});
	});
	function page(n, s) {
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/orders/tOrders/allOrderList">订单一览</a></li>
		<shiro:hasPermission name="orders:warn:view">
			<li><a href="${ctx}/orders/tOrders/warnOrderList">未调度订单预警</a></li>
		</shiro:hasPermission>
			<!--  <li ><a href="${ctx}/orders/tOrders/offlineOrderList">线下订单</a></li>-->
	</ul>
	<%-- <table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th><a href="${ctx}/orders/tOrders/allOrderList">线上订单</a></th>
				<th><a href="${ctx}/orders/tOrders/allOrderList?state=1">线下订单</a></th>
			</tr>
		</thead>
	</table> --%>
	<form:form id="searchForm" action="${ctx}/orders/tOrders/allOrderList"
		modelAttribute="TOrders" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
		<input id="pageSize" name="pageSize" type="hidden"	value="${page.pageSize}" />
		<%-- <input id="state" name="state" type="hidden" value="${state}"/> --%>
		<div class="control-group">
			<label class="control-label">订单名称：</label>
			<form:input path="ordername" htmlEscape="false" maxlength="50"
				class="input-small" />
			<label class="control-label">订单日期：</label> <input type="text"
				id="createDateQueryStart" name="createDateQueryStart" maxlength="20"
				readonly class="input-small Wdate"
				value="${tOrders.createDateQueryStart }"
				onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,maxDate:'#F{$dp.$D(\'createDateQueryEnd\')}'});" />
			至&nbsp; <input type="text" id="createDateQueryEnd"
				name="createDateQueryEnd" maxlength="20" readonly
				class="input-small Wdate" value="${tOrders.createDateQueryEnd }"
				onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,minDate:'#F{$dp.$D(\'createDateQueryStart\')}'});" />
			<label class="control-label">&nbsp;&nbsp;状态：</label> 
			<form:select path="orderstatus" class="input-mini">
				<option value="">全部</option>
				<form:options items="${fns:getDictList('orderstatus')}"
					itemLabel="label" itemValue="value" htmlEscape="false" />
			</form:select>
			<label>车队：</label>
				<form:select path="office" class="input-medium">
				<option value="">--请选择--</option>
				<form:options items="${fns:getOfficeListByFlatType(\"1\")}" itemLabel="name" itemValue="id" htmlEscape="false" />
				</form:select>
		</div>
		<div class="control-group">
			<label class="control-label">发车日期：</label> <input type="text"
				id="departdate" name="departdateStr" maxlength="20"
				readonly class="input-small Wdate"
				value="${tOrders.departdateStr }"
				onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true});" />
			<label class="control-label">车型：</label>
			<select id="cartype" name="cartype.cargotypeid" class="input-medium">
				<option value="">全部</option>
				<c:forEach items="${tCargotypeList}" var="cartype">
					<option value="${cartype.cargotypeid}"
						<c:if test="${cartype.cargotypeid eq tOrders.cartype.cargotypeid}">selected="selected"</c:if>>
							${cartype.typename}</option>
					</c:forEach>
			</select>
			<label class="control-label">订单号：</label>
			<form:input path="orderid" htmlEscape="false" maxlength="50"
				class="input-small digit" />
			<label>旅行商：</label>
				<form:select path="useroffice" class="input-medium">
				<option value="">--请选择--</option>
				<form:options items="${fns:getOfficeListByFlatType(\"2\")}" itemLabel="name" itemValue="id" htmlEscape="false" />
				</form:select>
		<input class="btn btn-primary" type="submit" value="查询" />
		<input id="btnExport" class="btn btn-primary" type="button" value="导出"/>
		</div>
		
	</form:form>
	<sys:message content="${message}" />
	<table class="table table-striped table-bordered table-condensed">
		<thead>
			<tr class="success">
				<th>订单号</th>
				<th>订单名称</th>
				<!-- <th>订单日期</th> -->
				<th>发车时间</th>
				<th>结束时间</th>
				<th>车型</th>
				<th>辆数</th>
				<th>订单金额</th>
				<th>实付金额</th>
				<th>优惠</th>
				<th>订单状态</th>
				<th>处理类型</th>
				<th>联系人</th>
				<th>联系方式</th>
				<th>调度状态</th>
				<th>归属</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
			<c:forEach items="${page.list}" var="orders">
				<tr>
					<td>${orders.orderid }</td>
					<td>${orders.ordername }<c:if test="${orders.istrouble == '1' }"><font title="${orders.reason }"><img src="${ctxStatic }/xiake/images/warn.png"/></font></c:if></td>
					<%-- <td><fmt:formatDate value="${orders.createDate }"
							pattern="yyyy-MM-dd HH:mm" /></td> --%>
					<td><fmt:formatDate value="${orders.departdate }"
							pattern="yyyy-MM-dd HH:mm" /></td>
					<td>${orders.endtime}</td>
					<td>${orders.cartype.typename}</td>
					<td>${orders.purchasenum}</td>
					<td><c:if test="${empty orders.cuponsPrice}">￥${orders.dueamount}</c:if><c:if test="${not empty orders.cuponsPrice}">￥${orders.cuponsPrice + orders.dueamount}</c:if></td>
					<td>￥${orders.dueamount}</td>
					<td><c:if test="${empty orders.cuponsPrice}">0</c:if><c:if test="${not empty orders.cuponsPrice}">￥${orders.cuponsPrice}</c:if></td>
					<td>${fns:getDictLabel(orders.orderstatus, 'orderstatus', '无')}
					</td>
					<td>${fns:getDictLabel(orders.settlereason, 'settlereason', '无')}</td>
					<td>${orders.contacts}</td>
					<td>${orders.payertel}</td>
					<td>${fns:getDictLabel(orders.realsche.dispstatus, 'dispatch', '无')}</td>
					<td>
						<c:if test="${orders.ordertype ne '7' }">线上</c:if>
						<c:if test="${orders.ordertype eq '7' }">线下</c:if>
					</td>
					<td>
					<shiro:hasPermission name="orders:plat:view">
						<a href="${ctx}/orders/tOrders/form?id=${orders.orderid}">查看</a>
					</shiro:hasPermission>
					<shiro:hasPermission name="orders:plat:edit">
						<c:if test="${orders.ordertype ne '5' }">
							<a href="${ctx}/orders/tOrders/troubleform?id=${orders.orderid}">标记问题订单</a>
						</c:if>
					</shiro:hasPermission>
					</td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>